package File;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-10-27
 * Time: 20:37
 */
public class Demo1 {

    public static void main(String[] args) {

        File file = new File("./test.txt/");
        System.out.println(file.exists());
        System.out.println(file.isFile());
        System.out.println(file.isDirectory());
    }

    public static void main1(String[] args) throws IOException {

        File file = new File("./test.txt");

        System.out.println(file.getParent());//返回file对象父目录及文件路径
        System.out.println(file.getName());//file对象名字
        System.out.println(file.getPath());//file对象文件路径
        System.out.println(file.getAbsolutePath());//返回file对象修饰过的相对路径
        System.out.println(file.getCanonicalPath());//绝对路径简化版本
    }
}
